3.4.74 \(\int (b \cos (c+d x))^n (A+B \cos (c+d x)+C \cos ^2(c+d x)) \sec ^2(c+d x) \, dx\) [374]

3.4.74.1 Optimal result
3.4.74.2 Mathematica [A] (verified)
3.4.74.3 Rubi [A] (verified)
3.4.74.4 Maple [F]
3.4.74.5 Fricas [F]
3.4.74.6 Sympy [F(-1)]
3.4.74.7 Maxima [F]
3.4.74.8 Giac [F]
3.4.74.9 Mupad [F(-1)]

3.4.74.1 Optimal result

Integrand size = 39, antiderivative size = 173 \[ \int (b \cos (c+d x))^n \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^2(c+d x) \, dx=\frac {b C (b \cos (c+d x))^{-1+n} \sin (c+d x)}{d n}-\frac {b (C (1-n)-A n) (b \cos (c+d x))^{-1+n} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {1}{2} (-1+n),\frac {1+n}{2},\cos ^2(c+d x)\right ) \sin (c+d x)}{d (1-n) n \sqrt {\sin ^2(c+d x)}}-\frac {B (b \cos (c+d x))^n \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {n}{2},\frac {2+n}{2},\cos ^2(c+d x)\right ) \sin (c+d x)}{d n \sqrt {\sin ^2(c+d x)}} \]

output
b*C*(b*cos(d*x+c))^(-1+n)*sin(d*x+c)/d/n-b*(C*(1-n)-A*n)*(b*cos(d*x+c))^(- 
1+n)*hypergeom([1/2, -1/2+1/2*n],[1/2+1/2*n],cos(d*x+c)^2)*sin(d*x+c)/d/(1 
-n)/n/(sin(d*x+c)^2)^(1/2)-B*(b*cos(d*x+c))^n*hypergeom([1/2, 1/2*n],[1+1/ 
2*n],cos(d*x+c)^2)*sin(d*x+c)/d/n/(sin(d*x+c)^2)^(1/2)
 
3.4.74.2 Mathematica [A] (verified)

Time = 0.57 (sec) , antiderivative size = 130, normalized size of antiderivative = 0.75 \[ \int (b \cos (c+d x))^n \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^2(c+d x) \, dx=-\frac {(b \cos (c+d x))^n \left ((C (-1+n)+A n) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {1}{2} (-1+n),\frac {1+n}{2},\cos ^2(c+d x)\right )+(-1+n) \left (B \cos (c+d x) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {n}{2},\frac {2+n}{2},\cos ^2(c+d x)\right )-C \sqrt {\sin ^2(c+d x)}\right )\right ) \tan (c+d x)}{d (-1+n) n \sqrt {\sin ^2(c+d x)}} \]

input
Integrate[(b*Cos[c + d*x])^n*(A + B*Cos[c + d*x] + C*Cos[c + d*x]^2)*Sec[c 
 + d*x]^2,x]
 
output
-(((b*Cos[c + d*x])^n*((C*(-1 + n) + A*n)*Hypergeometric2F1[1/2, (-1 + n)/ 
2, (1 + n)/2, Cos[c + d*x]^2] + (-1 + n)*(B*Cos[c + d*x]*Hypergeometric2F1 
[1/2, n/2, (2 + n)/2, Cos[c + d*x]^2] - C*Sqrt[Sin[c + d*x]^2]))*Tan[c + d 
*x])/(d*(-1 + n)*n*Sqrt[Sin[c + d*x]^2]))
 
3.4.74.3 Rubi [A] (verified)

Time = 0.61 (sec) , antiderivative size = 182, normalized size of antiderivative = 1.05, number of steps used = 8, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.205, Rules used = {3042, 2030, 3502, 25, 3042, 3227, 3042, 3122}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \sec ^2(c+d x) (b \cos (c+d x))^n \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\left (b \sin \left (c+d x+\frac {\pi }{2}\right )\right )^n \left (A+B \sin \left (c+d x+\frac {\pi }{2}\right )+C \sin \left (c+d x+\frac {\pi }{2}\right )^2\right )}{\sin \left (c+d x+\frac {\pi }{2}\right )^2}dx\)

\(\Big \downarrow \) 2030

\(\displaystyle b^2 \int \left (b \sin \left (\frac {1}{2} (2 c+\pi )+d x\right )\right )^{n-2} \left (C \sin \left (\frac {1}{2} (2 c+\pi )+d x\right )^2+B \sin \left (\frac {1}{2} (2 c+\pi )+d x\right )+A\right )dx\)

\(\Big \downarrow \) 3502

\(\displaystyle b^2 \left (\frac {\int -(b \cos (c+d x))^{n-2} (b (C (1-n)-A n)-b B n \cos (c+d x))dx}{b n}+\frac {C \sin (c+d x) (b \cos (c+d x))^{n-1}}{b d n}\right )\)

\(\Big \downarrow \) 25

\(\displaystyle b^2 \left (\frac {C \sin (c+d x) (b \cos (c+d x))^{n-1}}{b d n}-\frac {\int (b \cos (c+d x))^{n-2} (b (C (1-n)-A n)-b B n \cos (c+d x))dx}{b n}\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle b^2 \left (\frac {C \sin (c+d x) (b \cos (c+d x))^{n-1}}{b d n}-\frac {\int \left (b \sin \left (c+d x+\frac {\pi }{2}\right )\right )^{n-2} \left (b (C (1-n)-A n)-b B n \sin \left (c+d x+\frac {\pi }{2}\right )\right )dx}{b n}\right )\)

\(\Big \downarrow \) 3227

\(\displaystyle b^2 \left (\frac {C \sin (c+d x) (b \cos (c+d x))^{n-1}}{b d n}-\frac {b (C (1-n)-A n) \int (b \cos (c+d x))^{n-2}dx-B n \int (b \cos (c+d x))^{n-1}dx}{b n}\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle b^2 \left (\frac {C \sin (c+d x) (b \cos (c+d x))^{n-1}}{b d n}-\frac {b (C (1-n)-A n) \int \left (b \sin \left (c+d x+\frac {\pi }{2}\right )\right )^{n-2}dx-B n \int \left (b \sin \left (c+d x+\frac {\pi }{2}\right )\right )^{n-1}dx}{b n}\right )\)

\(\Big \downarrow \) 3122

\(\displaystyle b^2 \left (\frac {C \sin (c+d x) (b \cos (c+d x))^{n-1}}{b d n}-\frac {\frac {(C (1-n)-A n) \sin (c+d x) (b \cos (c+d x))^{n-1} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {n-1}{2},\frac {n+1}{2},\cos ^2(c+d x)\right )}{d (1-n) \sqrt {\sin ^2(c+d x)}}+\frac {B \sin (c+d x) (b \cos (c+d x))^n \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {n}{2},\frac {n+2}{2},\cos ^2(c+d x)\right )}{b d \sqrt {\sin ^2(c+d x)}}}{b n}\right )\)

input
Int[(b*Cos[c + d*x])^n*(A + B*Cos[c + d*x] + C*Cos[c + d*x]^2)*Sec[c + d*x 
]^2,x]
 
output
b^2*((C*(b*Cos[c + d*x])^(-1 + n)*Sin[c + d*x])/(b*d*n) - (((C*(1 - n) - A 
*n)*(b*Cos[c + d*x])^(-1 + n)*Hypergeometric2F1[1/2, (-1 + n)/2, (1 + n)/2 
, Cos[c + d*x]^2]*Sin[c + d*x])/(d*(1 - n)*Sqrt[Sin[c + d*x]^2]) + (B*(b*C 
os[c + d*x])^n*Hypergeometric2F1[1/2, n/2, (2 + n)/2, Cos[c + d*x]^2]*Sin[ 
c + d*x])/(b*d*Sqrt[Sin[c + d*x]^2]))/(b*n))
 

3.4.74.3.1 Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 2030
Int[(Fx_.)*(v_)^(m_.)*((b_)*(v_))^(n_), x_Symbol] :> Simp[1/b^m   Int[(b*v) 
^(m + n)*Fx, x], x] /; FreeQ[{b, n}, x] && IntegerQ[m]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3122
Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[Cos[c + d*x]*(( 
b*Sin[c + d*x])^(n + 1)/(b*d*(n + 1)*Sqrt[Cos[c + d*x]^2]))*Hypergeometric2 
F1[1/2, (n + 1)/2, (n + 3)/2, Sin[c + d*x]^2], x] /; FreeQ[{b, c, d, n}, x] 
 &&  !IntegerQ[2*n]
 

rule 3227
Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x 
_)]), x_Symbol] :> Simp[c   Int[(b*Sin[e + f*x])^m, x], x] + Simp[d/b   Int 
[(b*Sin[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x]
 

rule 3502
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*sin[(e_.) 
+ (f_.)*(x_)] + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(-C)*Co 
s[e + f*x]*((a + b*Sin[e + f*x])^(m + 1)/(b*f*(m + 2))), x] + Simp[1/(b*(m 
+ 2))   Int[(a + b*Sin[e + f*x])^m*Simp[A*b*(m + 2) + b*C*(m + 1) + (b*B*(m 
 + 2) - a*C)*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] 
 &&  !LtQ[m, -1]
 
3.4.74.4 Maple [F]

\[\int \left (\cos \left (d x +c \right ) b \right )^{n} \left (A +B \cos \left (d x +c \right )+C \left (\cos ^{2}\left (d x +c \right )\right )\right ) \left (\sec ^{2}\left (d x +c \right )\right )d x\]

input
int((cos(d*x+c)*b)^n*(A+B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c)^2,x)
 
output
int((cos(d*x+c)*b)^n*(A+B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c)^2,x)
 
3.4.74.5 Fricas [F]

\[ \int (b \cos (c+d x))^n \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^2(c+d x) \, dx=\int { {\left (C \cos \left (d x + c\right )^{2} + B \cos \left (d x + c\right ) + A\right )} \left (b \cos \left (d x + c\right )\right )^{n} \sec \left (d x + c\right )^{2} \,d x } \]

input
integrate((b*cos(d*x+c))^n*(A+B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c)^2,x, 
 algorithm="fricas")
 
output
integral((C*cos(d*x + c)^2 + B*cos(d*x + c) + A)*(b*cos(d*x + c))^n*sec(d* 
x + c)^2, x)
 
3.4.74.6 Sympy [F(-1)]

Timed out. \[ \int (b \cos (c+d x))^n \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^2(c+d x) \, dx=\text {Timed out} \]

input
integrate((b*cos(d*x+c))**n*(A+B*cos(d*x+c)+C*cos(d*x+c)**2)*sec(d*x+c)**2 
,x)
 
output
Timed out
 
3.4.74.7 Maxima [F]

\[ \int (b \cos (c+d x))^n \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^2(c+d x) \, dx=\int { {\left (C \cos \left (d x + c\right )^{2} + B \cos \left (d x + c\right ) + A\right )} \left (b \cos \left (d x + c\right )\right )^{n} \sec \left (d x + c\right )^{2} \,d x } \]

input
integrate((b*cos(d*x+c))^n*(A+B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c)^2,x, 
 algorithm="maxima")
 
output
integrate((C*cos(d*x + c)^2 + B*cos(d*x + c) + A)*(b*cos(d*x + c))^n*sec(d 
*x + c)^2, x)
 
3.4.74.8 Giac [F]

\[ \int (b \cos (c+d x))^n \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^2(c+d x) \, dx=\int { {\left (C \cos \left (d x + c\right )^{2} + B \cos \left (d x + c\right ) + A\right )} \left (b \cos \left (d x + c\right )\right )^{n} \sec \left (d x + c\right )^{2} \,d x } \]

input
integrate((b*cos(d*x+c))^n*(A+B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c)^2,x, 
 algorithm="giac")
 
output
integrate((C*cos(d*x + c)^2 + B*cos(d*x + c) + A)*(b*cos(d*x + c))^n*sec(d 
*x + c)^2, x)
 
3.4.74.9 Mupad [F(-1)]

Timed out. \[ \int (b \cos (c+d x))^n \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^2(c+d x) \, dx=\int \frac {{\left (b\,\cos \left (c+d\,x\right )\right )}^n\,\left (C\,{\cos \left (c+d\,x\right )}^2+B\,\cos \left (c+d\,x\right )+A\right )}{{\cos \left (c+d\,x\right )}^2} \,d x \]

input
int(((b*cos(c + d*x))^n*(A + B*cos(c + d*x) + C*cos(c + d*x)^2))/cos(c + d 
*x)^2,x)
 
output
int(((b*cos(c + d*x))^n*(A + B*cos(c + d*x) + C*cos(c + d*x)^2))/cos(c + d 
*x)^2, x)